import React, { useState } from 'react';
import _ from 'lodash';

const Index = () => {
  const [testData, setTestData] = useState({
    obj: { data: { name: '张三', age: 14, gender: '男' } },
    arr: ['a', 1, 2, 3]
  });

  return (
    <>
      <div>{_.get(testData, 'obj.data.name', '李四')}</div>
    </>
  );
};

export default Index;